package com.dy.nygl.util;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.jasper.tagplugins.jstl.core.ForEach;
import org.junit.Test;
//[0, 0, 0, 0, 0, 0, 560, 0, 0, 0, 0]

//Wed Aug 31 00:00:00 CST 2016:Sat Sep 03 00:00:00 CST 2016
//Sat Sep 03 00:00:00 CST 2016:Sat Sep 03 00:00:00 CST 2016
//Sat Sep 03 00:00:00 CST 2016:Tue Sep 06 00:00:00 CST 2016
//Tue Sep 06 00:00:00 CST 2016:Tue Sep 06 00:00:00 CST 2016
//Tue Sep 06 00:00:00 CST 2016:Fri Sep 09 00:00:00 CST 2016
//Fri Sep 09 00:00:00 CST 2016:Fri Sep 09 00:00:00 CST 2016
//Fri Sep 09 00:00:00 CST 2016:Mon Sep 12 00:00:00 CST 2016
//Mon Sep 12 00:00:00 CST 2016:Mon Sep 12 00:00:00 CST 2016
//Mon Sep 12 00:00:00 CST 2016:Thu Sep 15 00:00:00 CST 2016
//Thu Sep 15 00:00:00 CST 2016:Thu Sep 15 00:00:00 CST 2016

public class java {
	private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	@Test
	public void test() throws ParseException {
		String time ="2016-11";
		List<Date> sum = new ArrayList<>();
		for(int i = 0 ; i < 11 ; i++){
			if(i < 4){
				sum.add(dateFormat.parse(time + "-0" + String.valueOf(i*3) + " " + "00:00:00"));
				sum.add(dateFormat.parse(time + "-0" + String.valueOf((i+1)*3) + " " + "00:00:00"));
			}else if( i >= 4 && i < 11){
				sum.add(dateFormat.parse(time + "-" + String.valueOf(i*3)+ " "  + "00:00:00"));
				sum.add(dateFormat.parse(time + "-" + String.valueOf((i+1)*3)+ " "  + "00:00:00"));
			}else if(i == 11){
				sum.add(dateFormat.parse(time + "-" + String.valueOf(i*3)+ " "  + "00:00:00"));
				sum.add(dateFormat.parse(time + "-" + String.valueOf((i+1)*3)+ " "  + "00:00:00"));
			}
		}
		for (Date date : sum) {
			System.out.println(date);
		}
	}

}
